home *** CD-ROM | disk | FTP | other *** search
- Subject: BUG: Rendering Icons
- Sent: 6/26/96 2:05 PM
- Received: 6/26/96 2:11 PM
- From: Mike O'Connor, lepton@panix.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- I think it is a bug that FW_CIconShape::RenderIcon does not always honor
- the rect it is given for drawing.
-
- I start with a handle to an IconSuite, which I get by asking a Cyberdog
- CyberItem. In other words, I can't supply a file and resourceID, I must
- start with a handle to an icon suite. Then I make a FW_CIcon from that.
-
- The problem is that when you give the FW_CIcon constructor a handle to an
- icon suite, it computes the size of the icon by going through all the
- icons in the suite and finding the BIGGEST size icon in the suite. Thus,
- if you have a suite with both 16x16 and 32x32 icons, it is considered a
- 32x32 icon.
-
- This is different from making an FW_CIcon by supplying a resource file
- and ID to the constructor, because in that method, you can specify a size
- parameter which explicitly tells it which size icon you are interested in.
-
- Now, when I use RenderIcon in this FW_CIcon, it uses the size of the
- FW_CIcon to determine the size of the icon it will draw. I am supplying
- the method with a 16x16 rect to draw in, but this is overridden, as it
- thinks the icon itself is 32x32 and it draws a 32x32 icon with its
- topleft in the right place, but it blasts a 32x32 icon on the canvas.
-
- Peeping at the sources, I believe there are several places you might fix
- this. I would like to suggest adding an optional size parameter to the
- FW_CIcon constructor which accepts a FW_PlatformIcon. This breaks
- nothing, and could save a little memory by not loading unnecessary icons.
- IT doesn't solve the whole problem though. To do that, the Rendering of
- an icon should honor the size of the rect supplied it. If a 16x16 rect is
- given, it should draw a 16x16 icon. No way should it draw anything
- outside the rect, as it does now.
-
- By the way, I worked around this bug by going through the suite, removing
- any 32x32 icons within it, and then passing it to the FW_CIcon
- constructor. This was the only way I could draw a 16x16 icon from a suite
- which might contain 32x32 versions. It is not a perfect workaround
- because I am assuming the suite I'm given has at least one 16x16 icon in
- it.
-
- -Mike
-